/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListCandidatosVEPDSData {
	private static final int ROW_COUNT = 100;
	
	public void listTestData() throws PersistentException {
		System.out.println("Listing Candidatos...");
		orm_candidatos.Candidatos[] orm_candidatosCandidatoses = orm_candidatos.CandidatosDAO.listCandidatosByQuery(null, null);
		int length = Math.min(orm_candidatosCandidatoses.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(orm_candidatosCandidatoses[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Candidatos by Criteria...");
		orm_candidatos.CandidatosCriteria candidatosCriteria = new orm_candidatos.CandidatosCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//candidatosCriteria.id_candidato.eq();
		candidatosCriteria.setMaxResults(ROW_COUNT);
		orm_candidatos.Candidatos[] orm_candidatosCandidatoses = candidatosCriteria.listCandidatos();
		int length =orm_candidatosCandidatoses== null ? 0 : Math.min(orm_candidatosCandidatoses.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(orm_candidatosCandidatoses[i]);
		}
		System.out.println(length + " Candidatos record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListCandidatosVEPDSData listCandidatosVEPDSData = new ListCandidatosVEPDSData();
			try {
				listCandidatosVEPDSData.listTestData();
				//listCandidatosVEPDSData.listByCriteria();
			}
			finally {
				orm_candidatos.CandidatosVEPDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
